<link rel="stylesheet" type="text/css" href="assets/bootstrap-datepicker/css/datepicker.css" />
<form>
  <section id="container">
    <!--main content start-->
    <section id="main-content">
      <section class="wrapper">
        <!--state overview end-->
        <div class="row">
          <div class="col-lg-12">
            <section class="panel">
              <header class="panel-heading">
                会议纪要信息
              </header>
              <div class="panel-body">
                <div class="form-group customerForm">
                  <label class="col-sm-2 control-label">会议开始日期*</label>
                  <div class="col-sm-10">
                    <input id="time" type="text" value="" name="metTime" placeholder="日期选择" class="form-control"
                      onkeyup="this.value=this.value.replace(/(^\s+)|(\s+$)/g,'');">
                  </div>
                </div>
                <div class="form-group customerForm">
                  <label class="col-sm-2 control-label">会议时间段*</label>
                  <div class="col-sm-10">
                    <input type="text" value="" name="setime" id="setime" placeholder="例如:9:30-11:00"
                      class="form-control" onkeyup="this.value=this.value.replace(/(^\s+)|(\s+$)/g,'');">
                  </div>
                </div>
                <div class="form-group customerForm">
                  <label class="col-sm-2 control-label">会议主题*</label>
                  <div class="col-sm-10">
                    <textarea class="form-control" name="title" cols="10" onkeyup="this.value=this.value.replace(/(^\s+)|(\s+$)/g,'');"
                      maxlength="50" placeholder="字数限制(50字以内)">例会</textarea>
                  </div>
                </div>
                <div class="form-group customerForm">
                  <label class="col-sm-2 control-label">会议纪要*</label>
                  <div class="col-sm-10">
                    <textarea class="form-control" name="content" id="content" oninput="autoTextAreaHeight(this)"
                      onkeyup="this.value=this.value.replace(/(^\s+)|(\s+$)/g,'');" maxlength="1000" placeholder="字数限制(1000字以内)"></textarea>
                  </div>
                </div>
                <div class="form-group customerForm">
                  <label class="col-sm-2 control-label">参会人员*</label>
                  <div class="col-sm-10">
                    <textarea class="form-control" name="partakeUser" placeholder="例如:张三、李四" maxlength="120"
                      onkeyup="this.value=this.value.replace(/(^\s+)|(\s+$)/g,'');"></textarea>
                  </div>
                </div>
              </div>
            </section>
            <section class="panel">
              <div class="panel-body">
                <p class="default-buttons">
                  <a href="javascript:void(0);" class="button-back btn btn-info" onclick="window.history.back();">返回</a>
                  <a href="javascript:void(0);" class="button-next  btn btn-success submit">确认提交</a>
                </p>
              </div>
            </section>
          </div>
        </div>
      </section>
    </section>
  </section>
</form>
<script type="text/javascript" src="assets/bootstrap-datepicker/js/bootstrap-datepicker.js"></script>
<script>
  //时间控件
  $('#time').datepicker({
    format: 'yyyy-mm-dd'
  });

  function autoTextAreaHeight(o) {
    if ((o.scrollTop + o.scrollHeight) > 98) {
      o.style.height = o.scrollTop + o.scrollHeight + "px";
    }
  }
  $(function () {
    var ele = document.getElementById("content");
    autoTextAreaHeight(ele);
  });

  function addMeet(CertusFormAjax, $scope, $routeParams) {
    var myDate = new Date();
    $("#time").val(myDate.getFullYear() + "-" + myDate.getMonth() + "-" + myDate.getDate());
    $("#setime").val(myDate.getHours() + ":" + myDate.getMinutes());

    $(".submit").on('click', function () {
      var arr = $("form").serializeArray();
      var data = {};
      for (var i = 0; i < arr.length; i++) {
        data[arr[i].name] = arr[i].value;
      };
      data.proId = $routeParams.proId;
      if (data.metTime == "" || data.metTime == null || data.metTime == undefined) {
        layer.msg("会议开始日期不能为空！");
        return;
      }
      if (data.setime == "" || data.setime == null || data.setime == undefined) {
        layer.msg("会议时间段不能为空！");
        return;
      }
      if (data.title == "" || data.title == null || data.title == undefined) {
        layer.msg("会议主题不能为空！");
        return;
      }
      if (data.content == "" || data.content == null || data.content == undefined) {
        layer.msg("会议纪要不能为空！");
        return;
      }
      if (data.partakeUser == "" || data.partakeUser == null || data.partakeUser == undefined) {
        layer.msg("参会人员不能为空！");
        return;
      }
      CertusFormAjax.ajax("addMeeting", {
        "params": JSON.stringify(data)
      }, function () {
        layer.msg("提交成功");
        window.history.back();
      });
    })
  }
</script>